﻿#ifndef _FITFK_ACOUSTICS_FE_SUBSYS_ELEMENT_LIST_ADAPTOR_H___
#define _FITFK_ACOUSTICS_FE_SUBSYS_ELEMENT_LIST_ADAPTOR_H___

#include "FITKAcousticsAbstractAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include"FITK_Interface/FITKInterfaceModel/FITKModelEnum.h"
#include <H5Cpp.h>
namespace IO {
    class FITKHDF5FileTool;
}

namespace Acoustics{
    class FITKAcousticsFESubSysElementList;
}
namespace Interface {
    class FITKModelEnum;
    class FITKAbstractElement;
}

namespace IO
{
    class FITKAcousticsHDF5IOAPI FITKAcousticsFESubSysElementListAdaptor : public FITKAcousticsAbsAdaptor
    {
    public:
        explicit FITKAcousticsFESubSysElementListAdaptor() = default;
        virtual ~FITKAcousticsFESubSysElementListAdaptor() = default;

        virtual bool adaptR() override;

        virtual bool adaptW() override;

        void setData(Acoustics::FITKAcousticsFESubSysElementList*FESubSysElementListP);

    private:

        /**
        * @brief 读FE单元列表组
        * @param @param[i]  gp       hdf5组别
        * @param @param[i]  FESubSysElementListP     单元列表
        * @author yangjing (1195810980@qq.com)
        * @date 2024-1-22
        */
        bool readFESubSysElementList(H5::Group&gp, Acoustics::FITKAcousticsFESubSysElementList *FESubSysElementListP);

        /**
        * @brief 写FE单元列表组
        * @param @param[i]  gp       hdf5组别
        * @param @param[i]  FESubSysElementListP     单元列表数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-1-22
        */
        bool writeFESubSysElementList(H5::Group&gp, Acoustics::FITKAcousticsFESubSysElementList *FESubSysElementListP);
    private:

        /**
        * @brief 转换模型相关类型为int值
        * @param @param[i]  type       具体类别
        * @author yangjing (1195810980@qq.com)
        * @date 2024-1-22
        */
        int EleTypeFromInt(Interface::FITKModelEnum::FITKEleType type);



        /**
        * @brief int 值转换为模型相关类型
        * @param @param[i]  type       int值
        * @author yangjing (1195810980@qq.com)
        * @date 2024-1-22
        */
        Interface::FITKModelEnum::FITKEleType InToEleType(int type);


        /**
        * @brief 根据类型创建不同的子类
        * @param @param[i]  type       int值
        * @author yangjing (1195810980@qq.com)
        * @date 2024-1-22
        */
        Interface::FITKAbstractElement* FromTypeCreateEleClass(Interface::FITKModelEnum::FITKEleType type);
    private:

        IO::FITKHDF5FileTool*m_toolp{ nullptr };
        Acoustics::FITKAcousticsFESubSysElementList * m_FESubSysElementListP;
    };
    Register2FITKIOAdaptorFactory(FITKAcousticsHDF5, Acoustics::FITKAcousticsFESubSysElementList, FITKAcousticsFESubSysElementListAdaptor);
}
#endif
